var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
app.use(express.static(__dirname));
app.get('/',(req,res)=>{
    res.sendFile(__dirname+'/index.html');
});
io.sockets.on('connection',function(socket){
    socket.emit('welcome','欢迎来到全栈53-54');
//    创建一个监听事件监听客户端发来的信息
// CTS:Client to Server(从客户端发送到服务器)；
socket.on('CTS',function(data){
   //STC： Server to Client(从客户端发送到服务器)；
    socket.briadcast.emit('STC',data);
})
});
server.listen(8000);
console.log('server startup success in 8000');